const chalk = require('chalk')
const log = console.log
const warning = chalk.keyword('orange')
const red = chalk.bold.red

module.exports = function logInfo (logType, host, path, reqData, resData) {
  log(red('|'))
  log(red('|'))
  log(red('请求开始--------------------------'))
  log(chalk.blue('Node端请求后台地址为：', host))
  log(chalk.blue('请求路径为', path))
  log(chalk.blue('请求路参数', JSON.stringify(reqData)))
  if (logType === 'success') {
    log(warning('后台返回,成功，data为：', JSON.stringify(resData)))
  } else if (logType === 'error') {
    log(warning('后台返回,失败，data为：', JSON.stringify(resData)))
  } else {
    log(warning('后台返回,失败，catch data为：', JSON.stringify(resData)))
  }
  log(red('请求结束--------------------------'))
}
